package com.chwn.curiousdiary.bean;

import android.text.TextUtils;

import com.chwn.harulib.util.TimeUtils;

import java.io.Serializable;

/**
 * Created by Myshikin on 2017/3/20.
 * desc ：故事信息
 * ---故事名字	storyTitle	string
 * ---故事介绍	storyDetailTitle	string
 * ---故事封面	storyImage	string
 * ---故事音频时长	storyDuration	string
 * ---故事音频Url	storyUrl	string
 */
public class StoryBean implements Serializable {
    private String storyId;

    private String storyTitle;

    private String storyDetailTitle;

    private String storyImage;

    private String storyUrl;

    private String stroyShareURL;

    private int stroyPraiseCount;


    private String storyListenCount;

    private String storyCreateTime;

    public String getStoryListenCount() {
        return storyListenCount;
    }

    public String getStoryListenCountString() {
        String count = storyListenCount;
        try {
            if (Integer.parseInt(storyListenCount) > 10000) {
                count = Integer.parseInt(storyListenCount) / 10000 + "." + (Integer.parseInt(storyListenCount) % 10000) / 1000 + "万";
            } else {
                count = storyListenCount;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return count;
    }

    public void setStoryListenCount(String storyListenCount) {
        this.storyListenCount = storyListenCount;
    }

    public String getStoryCreateTime() {

        return this.storyCreateTime;
    }

    public String getStoryCreateTimeString() {
        if (TextUtils.isEmpty(storyCreateTime) || "未知".equals(storyCreateTime)) {
            return "未知";
        }
        return TimeUtils.getUpdateTime(storyCreateTime);
    }

    public void setStoryCreateTime(String storyCreateTime) {
        this.storyCreateTime = storyCreateTime;
    }

    /**
     * 故事类型
     */
    private String typeName;

    /**
     * 故事类型ID
     */
    private String typeId;

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getTypeId() {
        return typeId;
    }

    public void setTypeId(String typeId) {
        this.typeId = typeId;
    }

    /**
     * 0--未下载  1--已下载
     */
    private int downState;

    public int getDownState() {
        return downState;
    }

    public void setDownState(int downState) {
        this.downState = downState;
    }

    /**
     * 0--未收藏  1--已收藏
     */
    private int stroyCollectionState;

    /**
     * 0--未点赞  1--已点赞
     */
    private int storyPraiseState;

    public StoryBean(StoryListBean data) {
        this.storyId = data.getStoryId();
        this.storyTitle = data.getStoryTitle();
        this.storyDetailTitle = data.getStoryDetailTitle();
        this.storyImage = data.getStoryImage();
        this.storyUrl = data.getStoryUrl();
        this.stroyShareURL = data.getStroyShareURL();
        this.typeId = data.getTypeId();
        this.typeName = data.getTypeName();
        this.storyCreateTime = data.getStoryCreateTime();
        this.storyListenCount = data.getStoryListenCount() ;
    }



    public int getStroyPraiseCount() {
        return stroyPraiseCount;
    }

    public void setStroyPraiseCount(int stroyPraiseCount) {
        this.stroyPraiseCount = stroyPraiseCount;
    }

    public int getStroyCollectionState() {
        return stroyCollectionState;
    }

    public void setStroyCollectionState(int stroyCollectionState) {
        this.stroyCollectionState = stroyCollectionState;
    }

    public int getStoryPraiseState() {
        return storyPraiseState;
    }

    public void setStoryPraiseState(int storyPraiseState) {
        this.storyPraiseState = storyPraiseState;
    }

    public String getStroyShareURL() {
        return stroyShareURL;
    }

    public void setStroyShareURL(String stroyShareURL) {
        this.stroyShareURL = stroyShareURL;
    }

    public StoryBean(String storyTitle, String storyDetailTitle, String storyImage) {
        this.storyTitle = storyTitle;
        this.storyDetailTitle = storyDetailTitle;
        this.storyImage = storyImage;
    }

    public StoryBean(String storyTitle, String storyDetailTitle, String storyImage, String storyUrl) {
        this.storyTitle = storyTitle;
        this.storyDetailTitle = storyDetailTitle;
        this.storyImage = storyImage;
        this.storyUrl = storyUrl;
    }

    public StoryBean(String storyId, String storyTitle, String storyDetailTitle, String storyImage, String storyUrl, String stroyShareURL) {
        this.storyId = storyId;
        this.storyTitle = storyTitle;
        this.storyDetailTitle = storyDetailTitle;
        this.storyImage = storyImage;
        this.storyUrl = storyUrl;
        this.stroyShareURL = stroyShareURL;
    }

    public StoryBean() {
    }

    public String getStoryId() {
        return storyId;
    }

    public void setStoryId(String storyId) {
        this.storyId = storyId;
    }


    @Override
    public String toString() {
        return "StoryBean{" +
                "storyTitle='" + storyTitle + '\'' +
                ", storyDetailTitle='" + storyDetailTitle + '\'' +
                ", storyImage='" + storyImage + '\'' +
                ", storyUrl='" + storyUrl + '\'' +
                '}';
    }


    public String getStoryTitle() {
        return storyTitle;
    }

    public void setStoryTitle(String storyTitle) {
        this.storyTitle = storyTitle;
    }

    public String getStoryDetailTitle() {
        return storyDetailTitle;
    }

    public void setStoryDetailTitle(String storyDetailTitle) {
        this.storyDetailTitle = storyDetailTitle;
    }

    public String getStoryImage() {
        return storyImage;
    }

    public void setStoryImage(String storyImage) {
        this.storyImage = storyImage;
    }

    public String getStoryUrl() {
        return storyUrl;
    }

    public void setStoryUrl(String storyUrl) {
        this.storyUrl = storyUrl;
    }

    public String getData() {
        return storyUrl;
    }

    public String getTitle() {
        return storyTitle;
    }

}
